//Checks if a given URL is valid;

#ifndef URLVAL_H
#define URLVAL_H

#include <string>
#include "URL.h"
#include "../utils/inc/StringUtil.h"
#include "urlResolver.h"
class URLValidator{

		//Resolve Address
		//Strip off Query and/or fragment
		//Is it in scope
		//Is it HTML
		//	It's HTML if:
		//		-)does not have ? or #
		//		a)end with a '/'
		//		b)contains no period
		//		c)has extension in extenssion array

      private:
			URL base;
			string extension[11];
			bool preProcess(string *addr);
			//strips off Query or Fragment, ensures it's resolved;
			bool isResolved(string *addr);
			string* resolve(string *addr, URL *cursite);
			bool isHTML(string *addr);
			bool inScope(URL *url);

			void BasePreprocessor(string *baseSite);

      public:
			URLValidator(string *baseSite);
            URL validateURL(string *addr, URL *cursite);	//Process the URL
            URL getBaseAddr();
}; 

class InvalidSiteException{
public:
	string site;
	InvalidSiteException(string *s): site(*s){};
	friend ostream &operator<<(ostream &stream, InvalidSiteException *o);
};


#endif
